package demo.java.java8.Lambdas.demo4;

import java.util.Arrays;
import java.util.List;

import demo.java.java8.Lambdas.demo4.Dish.CaloricLevel;

public class Dish {
	
	public enum Type{MEAT,PISH,OTHER}
	public enum CaloricLevel{DIET,NORMAL,FAT}

	private final String name;
	private final boolean vegetarian;
	private final int calories;
	private final Type type;
	
	public Dish(String name,boolean vegetarian,int calories,Type type) {
		this.name=name;
		this.vegetarian=vegetarian;
		this.calories=calories;
		this.type=type;
	}
	
	public CaloricLevel  getCaloricLevel(){
		if(this.getCalories()<=400){
			return CaloricLevel.DIET;
		}else if(this.getCalories()<=700){
			return CaloricLevel.NORMAL;
		}else{
			return CaloricLevel.DIET;
		}
	}
	
	

	public String getName() {
		return name;
	}

	public boolean isVegetarian() {
		return vegetarian;
	}

	public int getCalories() {
		return calories;
	}

	public Type getType() {
		return type;
	}
	
	@Override
	public String toString() {
		return this.name;
	}
	
	
	public static void main(String[] args) {
		List<Dish> menu =  Arrays.asList(
				new Dish("pork", false, 800, Dish.Type.MEAT),
				new Dish("beef", false, 700, Dish.Type.MEAT),
				new Dish("chicken", false, 400, Dish.Type.MEAT),
				new Dish("french", true, 530, Dish.Type.OTHER),
				new Dish("rice", true, 350, Dish.Type.OTHER),
				new Dish("season", true, 120, Dish.Type.OTHER),
				new Dish("pizza", true, 550, Dish.Type.OTHER),
				new Dish("prawns", false, 300, Dish.Type.PISH),
				new Dish("salmon", false, 450, Dish.Type.PISH) );
//		List<String> arr=menu.stream()
//				.filter(d -> {
//								System.out.println("filtering:"+d.getName());
//								return d.getCalories() >500;
//							 })
//				.map(d ->{
//						System.out.println("mapping:"+d.getName());
//						return d.getName();
//				})
//				.limit(3)
//				.collect(toList());
//		System.out.println(arr);
		
//		List<String> title=Arrays.asList("Java8","In","Action");
//		Stream<String> s=title.stream();
//		s.forEach(System.out::println);
//		List<String> names=menu.stream().map(Dish::getName).collect(toList());
		
		
	}
	
}
 